package com.zhejiangzhengyuan.municipal_common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhejiangzhengyuan.municipal_common.entity.InspectionEvent;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * 巡检事件表，用于记录市政设施养护巡检任务中发现的事件数据 Mapper 接口
 *
 * @author linju
 * @since 2019-11-22
 */
@Repository
public interface InspectionEventMapper extends BaseMapper<InspectionEvent> {
  @Select(
      "select count(id) from inspection_event where create_time BETWEEN TIMESTAMP '${startTimestamp}' AND TIMESTAMP '${endTimestamp}'")
  int getBeforeActionCountByTimestamp(
      @Param("startTimestamp") String startTimestamp, @Param("endTimestamp") String endTimestamp);

  int getAfterActionCountByTimestamp(
      @Param("startTimestamp") String startTimestamp, @Param("endTimestamp") String endTimestamp);
}
